class H264Parser:
    def __init__(self):
        self.data = None
        self.start = False
        self.eof = True

    # todo: 去掉NAL头
    def parser(self, data):
        if self.data is None:
            self.data = data
        else:
            self.data += data

    def dump(self, file):
        if self.eof:
            start_code = [0, 0, 0, 1]
            file.write(start_code)
        file.write(self.data)
